
<style>
.CLOSED
{
	background-color:red;
}

</style>
<SCRIPT LANGUAGE=javascript>

jQuery(function($){


	//VALIDATION


	$("#contactform").validate({
		  rules: {
//			  email: {
//		      required: true,
//		      email: true
//		    },
		    firstname: {required: true},
		    lastname: {required: true},
//		    phone: {required: true},
		    type: {required: true},
		    from: {required: true, date: true},
		    till: {required: true, date: true}
		  }
		});
	
	
	
$.datepicker.regional['ru'] = {
		clearText: 'Очистить', clearStatus: '',
		closeText: 'Закрыть', closeStatus: '',
		prevText: '&#x3c;Пред',  prevStatus: '',
		prevBigText: '&#x3c;&#x3c;', prevBigStatus: '',
		nextText: 'След&#x3e;', nextStatus: '',
		nextBigText: '&#x3e;&#x3e;', nextBigStatus: '',
		currentText: 'Сегодня', currentStatus: '',
		monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь',
		'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
		monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн',
		'Июл','Авг','Сен','Окт','Ноя','Дек'],
		monthStatus: '', yearStatus: '',
		weekHeader: 'Не', weekStatus: '',
		dayNames: ['воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'],
		dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'],
		dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],
		dayStatus: 'DD', dateStatus: 'D, M d',
		dateFormat: 'yy-mm-dd', firstDay: 3,
		initStatus: '', isRTL: false,
		showMonthAfterYear: false, yearSuffix: ''};
	$.datepicker.setDefaults($.datepicker.regional['ru']);
});


var scheduledDays = [[10, 1, 2010, 'PEND'], [12, 3, 2008, 'PEND'], [12, 4, 2008, 'PEND']]
var holidayDays = [];

function setScheduledDays(date) {
    var isScheduled = false;
    var isHoliday = false;
    var scheduleStatus = "";

    // Check for scheduled day

    for (i = 0; i < scheduledDays.length; i++) {
      if (date.getMonth() == scheduledDays[i][0] - 1 && date.getDate() == scheduledDays[i][1] && date.getFullYear() == scheduledDays[i][2])
      {
        isScheduled = true;
        scheduleStatus = scheduledDays[i][3];
      }
    }

    // Check for holidays
    if (holidayDays != null)
    {
        for (i = 0; i < holidayDays.length; i++) {
          if (date.getMonth() == holidayDays[i][0] - 1 && date.getDate() == holidayDays[i][1] && date.getFullYear() == holidayDays[i][2])
          {
            isHoliday = true;
          }
        }
    }   

    if (isHoliday)
        return [false, 'CLOSED'];
    else if (isScheduled)
        return [true, scheduleStatus];
    else
      return [true, ''];
} 
</SCRIPT>

<SCRIPT LANGUAGE=javascript>
<!--
var activeDate = new Date('<?php echo date("m/d/Y")?>');
window.activeDate = new Date('<?php echo date("m/d/Y")?>');
$(document).ready(function()
{
	Assign();
 });



function process(datos) { 
	holidayDays = datos;
	$( "#datepicker_div" ).datepicker( "destroy" );
	$( "#datepicker_div" ).datepicker({numberOfMonths: 2,showButtonPanel: true,beforeShowDay: setScheduledDays,defaultDate: window.activeDate});
	};

function Assign()
{
	var id=$("#type").attr("value");
	$("#room_name").html(id);
	$.getJSON(url("book/get-dates"),{type:id},process,process);
	$('#type').change(Assign);
	$("#from").datepicker({ firstDay: 1, showStatus:true,yearRange: '2010:2011',defaultDate: activeDate,firstDay: 0,inline: true,showOtherMonths: true,beforeShowDay: setScheduledDays});
	$("#till").datepicker({ firstDay: 0, showStatus:true,yearRange: '2010:2011',defaultDate: activeDate,firstDay: 0,inline: true,showOtherMonths: true,beforeShowDay: setScheduledDays,});
	
	
	
}
//-->
</SCRIPT>

<script>
	$(function() {
		
	});
	</script>


<div style="float: right;">
<div id="room_name" style="color:#fcaf29;padding: 10px;font-weight: bold;"></div>
<div id="datepicker_div"></div>
</div>




<h2>Форма ручного бронирования</h2>


<span style="font-weight: bold;color: green"><?php echo $this->Message?></span>
<form action=""
	method="post" name="contactform" id="contactform">
<table>
	<tr>
		<td colspan="2">&nbsp;<div style="height: 100px;"></div></td>
	</tr>
	<tr>
		<td>Имя:</td>
		<td><input type="text" name="firstname" style="width: 200px" value="<?= $this->data['firstname']?>"   /></td>
	</tr>
	<tr>
		<td>Фамилия:</td>
		<td><input type="text" name="lastname" style="width: 200px" value="<?= $this->data['lastname']?>" /></td>
	</tr>
	<tr>

		<td>Тип:</td>





		<td><select name="type" id="type" style="width: 200px">
			<option>Рубиновый</option>
			<option>Жемчужный</option>
			<option>Лазурный</option>
			<option>Янтарный</option>
			<option>Малахитовый</option>
			<option>Хрустальный</option>
			<option>Алмазный</option>
			<option>Диамантовый</option>
			<option>Изумрудный</option>
			<option>Бирюзовый</option>
		</select>
		
		</td>

	</tr>


	<tr>

		<td>Дата заезда*:</td>

		<td><input type="text" name="from" id="from" style="width: 200px" value="<?= $this->data['from']?>" /></td>

	</tr>



	<tr>

		<td>Дата выезда*:</td>

		<td><input type="text" name="till" id="till" style="width: 200px" value="<?= $this->data['till']?>" /></td>

	</tr>


	<tr>
		<td colspan="2">&nbsp;<div style="height: 100px;"></div></td>
	</tr>


	<tr>

		<td>Примечание:</td>

		<td><textarea name="tip" cols="50" rows="5"><?= $this->data['tip']?>Ручная бронь</textarea></td>

	</tr>


<tr>
		<td>
<!--		<a class="button">Запрос</a>-->
		<input type="submit" value="Сохранить" name="go" />
		</td>
		<td>&nbsp;</td>
	</tr>
<tr>
<td colspan="2">
 
</td>
</tr>


<tr>
<td colspan="2">


</td>
</tr>



	

</table>




		<script>
		$(document).ready(function (){    

$("#gups").val("<?= $this->data['gups']?>");
$("#kids").val("<?= $this->data['kids']?>");
$("#type").val("<?= $this->data['type']?>");
			
			});
		</script>



</form>
